const {
	app,
	BrowserWindow,
	globalShortcut
} = require('electron')

const electron = require('electron')
/*获取electron窗体的菜单栏*/
const Menu = electron.Menu

let mainWindow

function createWindow() {
	// 隐藏菜单栏
	Menu.setApplicationMenu(null)

	mainWindow = new BrowserWindow({
		webPreferences: {
			webSecurity: false
		}
	})
	//配置ESC键退出全屏
	globalShortcut.register('ESC', () => {
		mainWindow.setFullScreen(false);
	})
	// 渲染的html文件
	mainWindow.loadFile('index.html')
	//进入软件即开启全屏
	mainWindow.setFullScreen(true);

	mainWindow.on('closed', function() {
		mainWindow = null
	})
}



app.on('ready', createWindow)

app.on('window-all-closed', function() {
	if (process.platform !== 'darwin') {
		app.quit()
	}
})

app.on('activate', function() {
	// On OS X it's common to re-create a window in the app when the
	// dock icon is clicked and there are no other windows open.
	if (mainWindow === null) {
		createWindow()
	}
})

// 开机自启
//app.setLoginItemSettings({  openAtLogin: true})
